﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage.Streams;
using Windows.UI.Xaml.Media.Imaging;
using System.Runtime.InteropServices.WindowsRuntime;
using System.IO;
using Windows.Graphics.Imaging;
using Windows.UI.Core;

namespace MusicExplorer.Extensions
{
    public static class ByteArrayExtensions
    {
        public static async Task<InMemoryRandomAccessStream> GetStreamAsync(this byte[] byteArray)
        {
            if (byteArray != null)
            {
                var stream = new InMemoryRandomAccessStream();
                await stream.WriteAsync(byteArray.AsBuffer());
                stream.Seek(0);
                return stream;
            }
            return null;
        }
    }
}
